function loadScript(js) {
	var s = document.createElement('script');
	s.src = js;
	document.body.appendChild(s);
}

if (sessionStorage.app) {
	loadScript('/www/cordova.js');
	setTimeout(function () {
		loadScript('/www/js/util.js');
	}, 500);
}

function wxPay(func) {
	return function (res) {
		var data = res.data;
		if (data.partnerid) {
			util.wxpay(data, func);
			return;
		}
		WeixinJSBridge.invoke('getBrandWCPayRequest', data, function (res) {
			if (res.err_msg == 'get_brand_wcpay_request:ok') func();
		});
	};
}